
package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.ProductUserEntity;
import com.xbongbong.saas.domain.entity.UserAndDepTeamEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface ProductUserDao {

    Integer insert(ProductUserEntity productUser);

    Integer update(ProductUserEntity productUser);

    Integer deleteByKey(@Param("key") Integer key, @Param("corpid") String corpid);

    ProductUserEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);

    List<ProductUserEntity> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    Integer deleteByParam(@Param("param") Map<String, Object> param);

    Integer deleteByProductId(@Param("productId") Integer productId, @Param("corpid") String corpid);

    void insertBatch(@Param("list") List<ProductUserEntity> insetBatchList);

    void updateBatch(@Param("list") List<ProductUserEntity> insetBatchList,@Param("corpid") String corpid);

    void updateBatchChildIds(@Param("list") List<ProductUserEntity> insetBatchList,@Param("corpid") String corpid);

    void updateBatchNotByCorpid(@Param("list") List<ProductUserEntity> insetBatchList);

    void deleteBatch(@Param("corpid") String corpid, @Param("delIdIn") List<Long> delIdList);

    void deleteBatchByScript(@Param("delIdIn") List<Long> delIdList);

    List<UserAndDepTeamEntity> findBaseEntitys(@Param("param") Map<String,Object> map);

    Integer deleteByParentIdInAndRelationIdIn(@Param("corpid") String corpid,@Param("parentIdIn")List<Long> parentIdIn, @Param("relationIdIn")List<Object> relationIdIn, @Param("type")Integer type);

    Integer deleteByProductIdInAndRelationIdIn(@Param("corpid") String corpid,@Param("productIdIn")List<Long> productIdIn, @Param("relationIdIn")List<Object> relationIdIn, @Param("type")Integer type);
}